/**
 * @author: 團長
 * @date: 2014-3-17-下午1:30:51
 */
package net.loyintean.pearlshell.basedb;

import net.loyintean.pearlshell.base.model.IResult;
import net.loyintean.pearlshell.basedb.dto.BaseDto;
import net.loyintean.pearlshell.basedb.exception.TransactionException;

/**
 * special interface for save data into data base.
 * <p>
 * Loy: add more constraint codition on the result of
 * {@link #saveSingleDto(BaseDto)}. v20140910.2.0.0
 * 
 * @author 團長
 * @version 20140910.2.0.0
 */
public interface ISaveDBService<T extends BaseDto> {

	/**
	 * save data into database.
	 * <p>
	 * generally, this method is used to save one dto as one row in one
	 * database. sometimes, the dto contains some sub-dto, and the row maps to
	 * some rows in another table.
	 * 
	 * @author 團長
	 * @since 2014-3-18
	 * @param dto
	 *            the data in dto will be save into database.
	 * @return status SUCCESS: everything is ok, and the getData() will return
	 *         the dao result.<br>
	 *         status FAIL: the rows or id returned by dao is less then zero.
	 * @throws TransactionException
	 *             this exception should callback the db commit.
	 */
	public IResult<Integer> saveSingleDto(T dto) throws TransactionException;
}
